package com.ms.service.module.analysisgroup;

import java.math.BigDecimal;

import com.xpec.c4.game.common.Helper;

/**
 * 玩家收支資料(只有紀錄正式幣)
 */
public class PlayerRevenueAndExpenditureData {

	/**
	 * 玩家收支警示差額 (totalScoreFormal + totalJPFormal)(收入) - totalBetFormal(支出)
	 */
	public static final BigDecimal PLAYER_ALERT_DIFFERENCE = new BigDecimal(5000000);
	
	private BigDecimal totalBetFormal;
	
	private BigDecimal totalScoreFormal;
	
	private BigDecimal totalJPFormal;
	
	private boolean isAlertAlready;
	
	public PlayerRevenueAndExpenditureData(){
		totalBetFormal = BigDecimal.ZERO;
		totalScoreFormal = BigDecimal.ZERO;
		totalJPFormal = BigDecimal.ZERO;
		isAlertAlready = false;
	}
	
	/**
	 * 判斷玩家是否達到收支差額警報
	 */
	public boolean isAlertDifference(){
		BigDecimal totalScore = Helper.add(totalScoreFormal, totalJPFormal);
		BigDecimal totalIncome = Helper.sub(totalScore, totalBetFormal);
		if(Helper.isGreaterEqual(totalIncome, PLAYER_ALERT_DIFFERENCE))
			return true;
		else return false;
	}

	public BigDecimal getTotalBetFormal() {
		return totalBetFormal;
	}

	public void setTotalBetFormal(BigDecimal totalBetFormal) {
		this.totalBetFormal = totalBetFormal;
	}

	public BigDecimal getTotalScoreFormal() {
		return totalScoreFormal;
	}

	public void setTotalScoreFormal(BigDecimal totalScoreFormal) {
		this.totalScoreFormal = totalScoreFormal;
	}

	public BigDecimal getTotalJPFormal() {
		return totalJPFormal;
	}

	public void setTotalJPFormal(BigDecimal totalJPFormal) {
		this.totalJPFormal = totalJPFormal;
	}

	public boolean isAlertAlready() {
		return isAlertAlready;
	}

	public void setAlertAlready(boolean isAlertAlready) {
		this.isAlertAlready = isAlertAlready;
	}
	
}
